package com.itfitness.cppdemoone.activity

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.itfitness.cppdemoone.R
import com.itfitness.cppdemoone.databinding.ActivityBoundaryfillBinding
import com.itfitness.cppdemoone.databinding.ActivityEdgecuttingBinding

/**
 *
 * @Description:     java类作用描述 边缘检测裁剪
 * @Author:         作者名
 * @CreateDate:     2022/2/23 17:01
 * @UpdateUser:     更新者：
 * @UpdateDate:     2022/2/23 17:01
 * @UpdateRemark:   更新说明：
 */
class EdgeCuttingActivity:AppCompatActivity(){
    private lateinit var edgecuttingBinding: ActivityEdgecuttingBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        edgecuttingBinding = DataBindingUtil.setContentView(this, R.layout.activity_edgecutting)
        val bitmapSrc = BitmapFactory.decodeResource(resources,R.drawable.ic_edgecut)
        edgecuttingBinding.activityEdgecuttingImgDest.setImageBitmap(imageEdgeCutting(bitmapSrc))
        bitmapSrc.recycle()
    }

    /**
     * 裁剪图像
     */
    fun createClipBitmap(src:Bitmap,x:Int,y:Int,width:Int,height:Int):Bitmap{
        return Bitmap.createBitmap(src,x,y,width,height)
    }




    external fun imageEdgeCutting(bitmapSrc:Bitmap):Bitmap
}